-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make missing field exception public #1983
Conversation
I still cannot wrap my head around the proper solution for #1930, so it's unlikely to fit into 1.4.0 timeline |
core/commonMain/src/kotlinx/serialization/SerializationExceptions.kt
Outdated
Show resolved
Hide resolved
val missedMessages = messages.filter { !exception.message!!.contains(it) } | ||
private inline fun assertFailsWithMessages(fields: List<String>, block: () -> Unit) { | ||
val exception = assertFailsWith(MissingFieldException::class, null, block) | ||
val missedMessages = fields.filter { !exception.message!!.contains(it) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
M.b. missedFields
?
Such a check is not very reliable !exception.message!!.contains(it)
, maybe always put names in single quotes and check !exception.message!!.contains("'$it'")
formats/json-tests/jvmTest/src/kotlinx/serialization/JvmMissingFieldsExceptionTest.kt
Outdated
Show resolved
Hide resolved
What about |
…gFieldsExceptionTest.kt Co-authored-by: Leonid Startsev <[email protected]>
@sandwwraith I found |
Fixes #1266